package com.ilomed.service;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ilomed.model.Goal;
import com.ilomed.repository.GoalRepository;
import com.ilomed.repository.GoalRepositoryImpl;

@Service("goalService")
public class GoalServiceImpl implements GoalService {
	
	private GoalRepository goalRepository;
	
	@Autowired
	public void setGoalRepository(GoalRepository goalRepository) {
		this.goalRepository = goalRepository;
	}

	@Transactional
	public Goal save(Goal goal) {
		return goalRepository.save(goal);
	}

	public List<Goal> findAllGoals() {
		return goalRepository.loadAll();
	}
	
	public List<Goal> findAll() {
		return goalRepository.findAll();
	}

}
